<?php

use Phinx\Migration\AbstractMigration;

class CreateScriptTable extends AbstractMigration
{
    /**
     * Migrate Up.
     */
    public function up()
    {
        $item = $this->table('script', ['id' => false, 'primary_key' => ['id'], 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '剧本']);

        $item->addColumn('id', 'integer', ['identity' => true, 'signed' => false, 'limit' => 11, 'comment' => '主键ID'])
            ->addColumn('project_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '项目id'])
            ->addColumn('episode_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '集id'])
            ->addColumn('content', 'text', ['null' => true, 'comment' => '剧本内容'])
            ->addColumn('version', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '版本'])
            ->addColumn('created', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '创建时间'])
            ->addColumn('updated', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '修改时间'])
            ->save();
    }

    /**
     * Migrate Down.
     */
    public function down()
    {
        $this->dropTable('script');
    }
}
